import request from "@/utils/request"
import type {ResponseData,PageData} from "@/api/type"
import type {SkuType} from "@/api/product/spu/type"


enum API {
    SKU_LIET_URL = '/admin/product/list/',
    SKU_CANCEL_SALE_URL = '/admin/product/cancelSale/',
    SKU_ON_SALE_URL = '/admin/product/onSale/',
    SKU_INFO_URL = '/admin/product/getSkuById/',
    DELETE_SKU_URL = '/admin/product/deleteSku/'
}

const getSkuList = (pageNo: number, pageSize: number,) => {
    return request.get<any, ResponseData<PageData<SkuType>>>(API.SKU_LIET_URL + `${pageNo}/${pageSize}`)
}

const cancelSale = (skuId: number) => {
    return request.get<any, ResponseData<string>>(API.SKU_CANCEL_SALE_URL + `${skuId}`)
}

const onSale = (skuId: number) => {
    return request.get<any, ResponseData<string>>(API.SKU_ON_SALE_URL + `${skuId}`)
}

const getSkuById = (skuId: number) => {
    return request.get<any, ResponseData<SkuType>>(API.SKU_INFO_URL + `${skuId}`)
}

const deleteSku = (skuId: number) => {
    return request.delete<any, ResponseData<string>>(API.DELETE_SKU_URL + `${skuId}`)
}
export {
    getSkuList,
    cancelSale,
    onSale,
    getSkuById,
    deleteSku
}
